package com.machine.action.buycomponent;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.machine.bean.BuyComponent;
import com.machine.service.user.BuyComponentServiceDao;
import com.opensymphony.xwork2.ActionSupport;

@Component("addBuyComAction")
@Scope(value = "prototype")
public class AddBuyComAction extends ActionSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private BuyComponentServiceDao buyComponentServiceDao;

	private BuyComponent buyComponent;

	public BuyComponent getBuyComponent() {
		return buyComponent;
	}

	public void setBuyComponent(BuyComponent buyComponent) {
		this.buyComponent = buyComponent;
	}

	public BuyComponentServiceDao getBuyComponentServiceDao() {
		return buyComponentServiceDao;
	}

	@Resource(name = "buyComponentService")
	public void setBuyComponentServiceDao(
			BuyComponentServiceDao buyComponentServiceDao) {
		this.buyComponentServiceDao = buyComponentServiceDao;
	}

	@Override
	public String execute() throws Exception {
		
		buyComponentServiceDao.addBuyCom(buyComponent);

		return super.execute();
	}

}
